<%
# Renders the workload data for one single user.
# Parameters:
#  * user: The user to render the data for.
#  * data: The data to render. A hash with issues as keys.
%>

<tbody class="user-total-workload" id="user-total-workload-<%= user.id %>">
  <tr>
	<th class="user-description" scope="row" title="<%= l(:workload_trigger_tooltip) %>">
	  <%= render :partial => 'trigger', :locals => {:trigger_for => "user-#{user.id}"} %>
	  <%= "#{user.firstname} #{user.lastname}" %>
	  <% if data[:overdue_number] > 0 %>
		<dl class="additional-user-info user-<%= user.id %>-open user-<%= user.id %>-close">
		  <dt><%= l(:workload_overdue_issues_num) %></dt>
		  <dd><%= data[:overdue_number] %></dd>
		  <dt><%= l(:workload_overdue_issues_hours) %></dt>
		  <dd><%= "%0.2f" % data[:overdue_hours] %></dd>
		</dl>
	  <% end %>
	</th>
	<% # Print the total workload for this user for each day %>
	<%= render :partial => 'total_workload', :locals => {:totalWorkload => data[:total]} %>
  </tr>
</tbody>

<% if !data[:invisible].empty? %>
  <tbody class="invisible-issues-summary user-<%= user.id %>-open user-<%= user.id %>-close">
	<tr>
	  <th class="invisible-workload-description" scope="row"><%= l(:workload_show_invisible_issues) %> </th>
	  <%= render :partial => 'summarized_workload_for_invisible_issues', :locals => {:user => user, :summarizedWorkload => data[:invisible]} %>
	</tr>
  </tbody>
<% end %>
<% # Iterate over all projects for the user %>
<% projects = data.keys.select{|x| x.kind_of?(Project)} %>
<% projects.each do |project| %>
   <%= render :partial => 'workload_for_project', :locals => {:user => user, :project => project, :data => data[project]} %>
<% end %>